//
//  OceanBaseTableCell.m
//  OceanStaffApp
//
//  Created by Zheng on 2019/7/31.
//  Copyright © 2019 Zh. All rights reserved.
//

#import "OceanBaseTableCell.h"

@implementation OceanBaseTableCell

+ (__kindof OceanBaseTableCell *)createTableViewCell:(UITableView *)tableView
                                           indexPath:(NSIndexPath *)indexPath
                                               model:(__kindof OceanBaseModel *)model {
    NSString *modelName = NSStringFromClass([model class]);
    NSString *cellID = [[modelName substringToIndex:modelName.length-5] stringByAppendingString:@"CellID"];
    OceanBaseTableCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath];
    [cell configDataWithModel:model];
    return cell;
}

- (void)configDataWithModel:(__kindof OceanBaseModel *)model {
    _model = model;
    [self updateDataWithModel:_model];
}

- (void)updateDataWithModel:(__kindof OceanBaseModel *)model {}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}
@end
